/*
 * RSParam.h
 *
 *  Created on: 2010/03/16
 *      Author: alexandre
 */

#ifndef RSPARAM_H_
#define RSPARAM_H_

#include "RSElement.h"

namespace Realsphere {

    class RSParam : public Realsphere::RSElement {
        Q_OBJECT
        Q_PROPERTY ( QString _attr_name READ Name )
        Q_PROPERTY ( QString _attr_sid READ ScopeId  )
        Q_PROPERTY ( QString _attr_type READ DataType )
        Q_PROPERTY ( QString _attr_semantic READ Semantic  )
        public:
            Q_INVOKABLE RSParam ( Realsphere::RSAccessor* rAccessor,
                                  Realsphere::RSValueType rDataType,
                                  const QString& rName = QString::null,
                                  const QString& rScopeId = QString::null,
                                  Realsphere::RSInputSemanticType rSemantic = RS_SEMANTIC_UNKNOWN );

            virtual ~RSParam ();

        public:
            QString                 ScopeId () const;
            RSValueType             DataType () const;
            RSDataSize              DataSize() const;
            RSInputSemanticType     Semantic () const;
            bool                    IsRootElement () const;

        public slots:
            void                    SetScopeId ( const QString& rScopeId, bool rEmit = true );
            void                    SetSemantic ( RSInputSemanticType rSemantic, bool rEmit = true );

        signals:
            void                    ScopeIdChanged ( const QString& rScopeId );
            void                    SemanticChanged ( RSInputSemanticType rSemantic );
            void                    ValueChanged ();

        protected:
            RSError                 BeforeAddChildElement ( RSElement* rChild );

        private:
            QString                 mScopeId;
            RSValueType             mDataType;
            RSInputSemanticType     mSemantic;
    };

}

#endif /* RSPARAM_H_ */
